package com.sdry.model.lqy;

public class WorkstationDetail {
	//id
	private String id;
	//人数
	private String people;
	//工作时间
	private String work;
	//实际产量 
	private String fact;
	//计划产量
	private String theory;
	//完成率
	private String difference;
	//二次捡漏
	private String fact2;
	//二次捡漏
	private String theory2;

	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getPeople() {
		return people;
	}
	public void setPeople(String people) {
		this.people = people;
	}
	public String getWork() {
		return work;
	}
	public void setWork(String work) {
		this.work = work;
	}
	public String getFact() {
		return fact;
	}
	public void setFact(String fact) {
		this.fact = fact;
	}
	public String getTheory() {
		return theory;
	}
	public void setTheory(String theory) {
		this.theory = theory;
	}
	public String getDifference() {
		return difference;
	}
	public void setDifference(String difference) {
		this.difference = difference;
	}
	public String getFact2() {
		return fact2;
	}
	public void setFact2(String fact2) {
		this.fact2 = fact2;
	}
	public String getTheory2() {
		return theory2;
	}
	public void setTheory2(String theory2) {
		this.theory2 = theory2;
	}
	public void add(WorkstationDetail work) {
		if(work==null) {
			
		}else {
			int Apeople=ItoS(work.people);
			int Afact=ItoS(work.fact);
			int Atheory=ItoS(work.theory);
			int Afact2=ItoS(work.fact2);
			int Atheory2=ItoS(work.theory2);
			long Awork=sss(work.work);
//			long Adifferent=differen(work.difference);
			
			int Ypeople=ItoS(this.people);
			int Yfact=ItoS(this.fact);
			int Ytheory=ItoS(this.theory);
			int Yfact2=ItoS(this.fact2);
			int Ytheory2=ItoS(this.theory2);
			long Ywork=sss(this.work);
//			long Ydifferent=differen(this.difference);
			
//			Long newdifferent=(Adifferent+Ydifferent)/2;
//			this.difference=newdifferent+"%";
			
			this.people=Apeople+Ypeople+"";
			this.fact=Afact+Yfact+"";
			this.theory=Atheory+Ytheory+"";
			this.fact2=Afact2+Yfact2+"";
			this.theory2=Atheory2+Ytheory2+"";
			this.work=time(Awork+Ywork);
		}
	
		
	}
	
	public static Long sss(String time){
		if(null==time) {
			return 0L;
		}
		if(time.equals("0")) {
			return 0L;
		}
		int i = time.indexOf("时");
		int i2 = time.indexOf("分");
		int i3 = time.indexOf("秒");
		String hourse = time.substring(0, i);
		String minute = time.substring(i+1, i2);
		String second = time.substring(i2+1, i3);
		Long h = Long.parseLong(hourse)*3600000;
		Long m = Long.parseLong(minute)*60000;
		Long s = Long.parseLong(second)*1000;
		return h+m+s; 
	}
	
	
	
	
//	public static Long differen(String different){
//		if(null==different) {
//			return 0L;
//		}
//		if(different.equals("0")) {
//			return 0L;
//		}
//		int i = different.indexOf("%");
//		
//		String hourse = different.substring(0, i);
//		
//		Number num = Float.parseFloat(hourse)*100;
//		 int oamount = num.intValue();
//	        long _cost = Long.valueOf(oamount);
//		//long l = Long.valueOf(hourse).longValue();
//		return _cost; 
//	}
	
	public int ItoS(String st) {
		int a;
		if(null==st) {
			a=0;
		}else {
			a = Integer.parseInt(st);
		}
		return a;
	}
	
	public static String time(Long number){
		Long hourse = number/1000/3600;
		Long minute = (number%(3600*1000))/1000/60;
		Long second = (number%(3600*1000*60))%(1000*60)/1000;
		return hourse + "时" + minute + "分" + second + "秒";
	}
	
	
	
	public void adds(WorkstationDetail work) {
		if(work==null) {
			
		}else {
			int Apeople=ItoS(work.people);
			int Afact=ItoS(work.fact);
			int Atheory=ItoS(work.theory);
			int Afact2=ItoS(work.fact2);
			int Atheory2=ItoS(work.theory2);
			
			
			int Ypeople=ItoS(this.people);
			int Yfact=ItoS(this.fact);
			int Ytheory=ItoS(this.theory);
			int Yfact2=ItoS(this.fact2);
			int Ytheory2=ItoS(this.theory2);
			
			
			this.people=Apeople+Ypeople+"";
			this.fact=Afact+Yfact+"";
			this.theory=Atheory+Ytheory+"";
			this.fact2=Afact2+Yfact2+"";
			this.theory2=Atheory2+Ytheory2+"";
			
		}
	
		
	}

	
}
